﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using OgilvyOne.BLL;
using OgilvyOne.Model;

using OgilvyOne.UKNow.BLL;
using OgilvyOne.UKNow.Model;
using System.Collections.Generic;
using ECCIT;

public partial class admin_UKNOW_element_element_list :  AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.headers.Text = new ColumnBll().LayeridColumnConNaiv(Request.Params["layerid"]);
            Grid_viewBild();
        }
    }

    private void Grid_viewBild()
    {
        int columnid = int.Parse(Request.Params["columnid"]);
        ColumnModel cm = new ColumnBll().GetColumn(columnid);
        IList<WarmupModel> Warmupsls = new WarmupBLL(LangID).selectwarmups();
        GridView1.DataSource = Warmupsls;
        GridView1.PageSize = 10;
        GridView1.DataBind();
        this.pagehtml.Text = getPageHtml(GridView1.PageCount, GridView1.PageIndex + 1, Warmupsls.Count);
    }
    protected void Add_click(object sender, EventArgs e)
    {
        Response.Redirect("element_add.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"] + "&langID=" + Request.Params["langID"], true);
    }


    protected void Del_click(object sender, EventArgs e)
    {
        int wid = int.Parse(((LinkButton)sender).CommandArgument);
        ResultInfo res = new WarmupBLL(LangID).delWarmup(wid);
        if (res.Result)
        {
            Response.Write("<script>alert('" + res.Message + "')</script>");
        }
        else
        {
            Response.Write(res.Message);
        }
       
        //删除作品的数据记录
        Grid_viewBild();
    }

    protected void Pubone_click(object sender, EventArgs e)
    {
        //修改单个元素的发布状态
        int wid = int.Parse(((LinkButton)sender).CommandArgument);
        new WarmupBLL(LangID).modPubOne(wid);
        Grid_viewBild();
    }

    //protected void Mod_click(object sender, EventArgs e)
    //{
    //    Response.Redirect("event_mod.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"] + "&eid=" + ((LinkButton)sender).CommandArgument, true);
    //}

    //protected void Img_click(object sender, EventArgs e)
    //{
    //    Response.Redirect("event_img_list.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"] + "&langID=" + Request.Params["langID"] + "&EventsID=" + ((LinkButton)sender).CommandArgument, true);
    //}
    protected void Coment_click(object sender, EventArgs e)
    {
        Response.Redirect("element_comment_list.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"] + "&langID=" + Request.Params["langID"] + "&WarmupsID=" + ((LinkButton)sender).CommandArgument, true);
    }
    protected void Return_click(object sender, EventArgs e)
    {
        Response.Redirect("element_list.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"] + "&langID=" + Request.Params["langID"], true);
    }
}
